﻿using D.Medicalcare.Domain.Entities;
using D.Medicalcare.ErrorCode;
using D.Medicalcare.Infrastructure.Interfaces;
using D.Medicalcare.Read.API.Application.Command.DoorSpendCommand;
using D.Medicalcare.Read.API.Application.Command.OutpatientConsumptionCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace D.Medicalcare.Read.API.Controllers
{
    /// <summary>
    /// 门诊充值控制器-读
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class OutpatientConsumptionController : ControllerBase
    {
        private readonly IMediator mediator;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="mediator"></param>
        public OutpatientConsumptionController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 门诊充值列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPaging<OutpatientConsumption>> GetOutpatientConsumption([FromQuery]GetOutpatientConsumptionCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
